//
//  LoginViewController.m
//  UI2_设计模式课后作业
//
//  Created by dllo on 15/11/9.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "LoginViewController.h"
#import "LoginView.h"
#import "ButtonView.h"

@interface LoginViewController ()

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
//    UIImage *image = [UIImage imageNamed:@"/Users/dllo/Desktop/DLS151034/UI1_View_Label/UI1_View_Label课后作业/HW1_2/HW1_2/1080.1980.jpg"];
//    self.view.layer.contents = (id)image.CGImage;
    
    LoginView *view1 = [[LoginView alloc] initWithFrame:CGRectMake(50, 100, [UIScreen mainScreen].bounds.size.width - 50 * 2, 30)];
    
    view1.label.text = @"用户名";
    view1.textF.placeholder = @"请输入用户名";
    [self.view addSubview:view1];
    [view1 release];
    
    LoginView *view2 = [[LoginView alloc] initWithFrame:CGRectMake(view1.frame.origin.x, view1.frame.origin.y + view1.frame.size.height + 20, view1.frame.size.width, view1.frame.size.height)];
    view2.label.text = @"密码";
    view2.textF.placeholder = @"请输入密码";
    view2.textF.secureTextEntry = YES;
    [self.view addSubview:view2];
    [view2 release];
    
    LoginView *view3 = [[LoginView alloc] initWithFrame:CGRectMake(view1.frame.origin.x, view2.frame.origin.y + view2.frame.size.height + 20, view2.frame.size.width, view2.frame.size.height)];
    view3.label.text = @"确认密码";
    view3.textF.placeholder = @"再次输入密码";
    view3.textF.secureTextEntry = YES;
    [self.view addSubview:view3];
    [view3 release];
    
    LoginView *view4 = [[LoginView alloc] initWithFrame:CGRectMake(view3.frame.origin.x, view3.frame.origin.y + view3.frame.size.height + 20, view3.frame.size.width, view3.frame.size.height)];
    view4.label.text = @"手机号";
    view4.textF.placeholder = @"请输入联系方式";
    view4.textF.secureTextEntry = YES;
    [self.view addSubview:view4];
    [view4 release];
    
    LoginView *view5 = [[LoginView alloc] initWithFrame:CGRectMake(view4.frame.origin.x, view4.frame.origin.y + view4.frame.size.height + 20, view4.frame.size.width, view4.frame.size.height)];
    view5.label.text = @"邮箱";
    view5.textF.placeholder = @"请输入邮箱";
    view5.textF.secureTextEntry = YES;
    [self.view addSubview:view5];
    [view5 release];
    
    ButtonView *button1 = [[ButtonView alloc] initWithFrame:CGRectMake(view5.frame.origin.x, view5.frame.origin.y + view5.frame.size.height + 50, 50, view5.frame.size.height)];
    [button1.button setTitle:@"注册" forState:UIControlStateNormal];
    [button1.button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [button1.button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button1];
    
    ButtonView *button2 = [[ButtonView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - button1.frame.origin.x * 2, button1.frame.origin.y, button1.frame.size.width, button1.frame.size.height)];
    [button2.button setTitle:@"取消" forState:UIControlStateNormal];
    [button2.button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
    [button2.button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button2];
    
    
    
    
    
}

- (void)buttonAction:(id)sender
{
    self.view.backgroundColor = [UIColor colorWithRed:(arc4random() % 256) / 255.0 green:(arc4random() % 256) / 255.0 blue:(arc4random() % 256) / 255.0 alpha:1.0];
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
